﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;

public partial class Cadastros_Turma : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void rapGrid_AjaxRequest(object sender, Telerik.Web.UI.AjaxRequestEventArgs e)
    {
        rdg_Turma.DataSourceID = ods_Turma.ID;
        rdg_Turma.DataBind();
    }
    protected void ods_Material_Selecting(object sender, ObjectDataSourceSelectingEventArgs e)
    {
        e.InputParameters["TURMA_ID"] = turma_id.Text;
        e.InputParameters["TUR_DESCRICAO"] = tur_descricao.Text;
        e.InputParameters["MODALIDADE_ID"] = modalidade_id.SelectedValue;
        e.InputParameters["SALA_ID"] = sala_id.SelectedValue;
        e.InputParameters["TURNO_ID"] = turno_id.SelectedValue;
        e.InputParameters["NIVEL_ID"] = nivel_id.SelectedValue;
        e.InputParameters["ORDER_BY_CLAUSE"] = rcb_orderBy.SelectedValue;
        
    }
    protected void modalidade_id_ItemsRequested(object o, Telerik.Web.UI.RadComboBoxItemsRequestedEventArgs e)
    {
        modalidade_id.DataSourceID = ods_Modalidade.ID;
        modalidade_id.DataBind();
    }
    protected void sala_id_ItemsRequested(object o, Telerik.Web.UI.RadComboBoxItemsRequestedEventArgs e)
    {
        sala_id.DataSourceID = ods_Sala.ID;
        sala_id.DataBind();
    }
    protected void turno_id_ItemsRequested(object o, Telerik.Web.UI.RadComboBoxItemsRequestedEventArgs e)
    {
        turno_id.DataSourceID = ods_Turno.ID;
        turno_id.DataBind();
    }
    protected void nivel_id_ItemsRequested(object o, Telerik.Web.UI.RadComboBoxItemsRequestedEventArgs e)
    {
        nivel_id.DataSourceID = ods_Nivel.ID;
        nivel_id.DataBind();
    }
    protected void rdg_Turma_ItemCreated(object sender, Telerik.Web.UI.GridItemEventArgs e)
    {
        if (e.Item is GridDataItem)
        {
            try
            {

                //Editar Inspeções
                ImageButton imgbEditar = (ImageButton)e.Item.FindControl("imgGridEditar");
                imgbEditar.Attributes["onclick"] = String.Format("return ShowEditForm('{0}','{1}');", e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["TURMA_ID"], e.Item.ItemIndex);
                //Excluir
                ImageButton imgExcluir = (ImageButton)e.Item.FindControl("imgbGridExcluir");
                imgExcluir.Attributes["onclick"] = String.Format("return WndDelete('{0}','{1}');", e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["TURMA_ID"], e.Item.ItemIndex);
                //Exibir Alunos que Adquiriram o Material
                ImageButton imgbPNAplicavel = (ImageButton)e.Item.FindControl("imgGridAlunosadquirentes");
                imgbPNAplicavel.Attributes["onclick"] = String.Format("return ShowAlunosTurma('{0}','{1}');", e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["TURMA_ID"], e.Item.ItemIndex);
            }
            catch
            { }

        }
    }
    protected void rdg_Turma_SelectedIndexChanged(object sender, EventArgs e)
    {

    }
}